<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>NormalSystem</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
      <script type="text/javascript" src="./js/jquery.js"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <script type="text/javascript" src="./js/admin.js"></script>
  </head>
  
  <body>
    <div class="x-body" id="adminBind">
        <!--<form class="layui-form" lay-filter="adminForm">-->
            <!--<input type="hidden" id="id" name="id" />-->
          <!--<div class="layui-form-item">-->
              <!--<label for="name" class="layui-form-label">-->
                  <!--<span class="x-red">*</span>用户姓名-->
              <!--</label>-->
              <!--<div class="layui-input-inline">-->
                  <!--<input type="text" id="name" name="name" required="" lay-verify="required"-->
                  <!--autocomplete="off" class="layui-input">-->
              <!--</div>-->
              <!--<div class="layui-form-mid layui-word-aux">-->
                  <!--<span class="x-red">*</span>-->
              <!--</div>-->
          <!--</div>-->
          <!--<div class="layui-form-item">-->
              <!--<label for="tel" class="layui-form-label">-->
                  <!--<span class="x-red">*</span>手机-->
              <!--</label>-->
              <!--<div class="layui-input-inline">-->
                  <!--<input type="text" id="tel" name="tel" required="" lay-verify="phone"-->
                  <!--autocomplete="off" class="layui-input">-->
              <!--</div>-->
              <!--<div class="layui-form-mid layui-word-aux">-->
                  <!--<span class="x-red">*</span>-->
              <!--</div>-->
          <!--</div>-->
            <!--<div class="layui-form-item">-->
                <!--<label for="account" class="layui-form-label">-->
                    <!--<span class="x-red">*</span>登录名-->
                <!--</label>-->
                <!--<div class="layui-input-inline">-->
                    <!--<input type="text" id="account" name="account" required="" lay-verify="required"-->
                           <!--autocomplete="off" class="layui-input">-->
                <!--</div>-->
                <!--<div class="layui-form-mid layui-word-aux">-->
                    <!--<span class="x-red">*</span>将会成为唯一的登入名-->
                <!--</div>-->
            <!--</div>-->
          <!--<div class="layui-form-item">-->
              <!--<label for="L_pass" class="layui-form-label">-->
                  <!--<span class="x-red">*</span>密码-->
              <!--</label>-->
              <!--<div class="layui-input-inline">-->
                  <!--<input type="password" id="L_pass" name="pwd" required="" lay-verify="pass"-->
                  <!--autocomplete="off" class="layui-input">-->
              <!--</div>-->
              <!--<div class="layui-form-mid layui-word-aux">-->
              <!--</div>-->
          <!--</div>-->
          <!--<div class="layui-form-item">-->
              <!--<button  class="layui-btn" lay-filter="add" lay-submit="">-->
                  <!--保存-->
              <!--</button>-->
          <!--</div>-->
      <!--</form>-->
    </div>
    <script>
        var str=location.href; //取得整个地址栏
        var num=str.indexOf("?")
        str=str.substr(num+1); //取得所有参数   stringvar.substr(start [, length ]
        var arr=str.split("&"); //各个参数放到数组里
        var userName = decodeURI(arr[1].substr(arr[1].indexOf("=")+1)),userId = arr[0].substr(arr[0].indexOf("=")+1);

        var obj = new Object();
        obj.optId = userId;
        myAjax($, 'ms-pms/role/list', obj, function (res) {
            var html = '';
            html += '<form class="layui-form" action="" lay-filter="adminForm" >\n' ;
            html += '      <div class="layui-form-item">\n' ;
            html += '          <label class="layui-form-label">用户姓名</label>\n' ;
            html += '          <div class="layui-input-block">\n' ;
            html += '          <input type="hidden" value="'+userId+'" name="optId" />\n' ;
            html += '              <input type="text" value="'+userName+'" name="title" lay-verify="title" autocomplete="off" readonly class="layui-input">\n' ;
            html += '          </div>\n' ;
            html += '      </div>\n' ;
            html += '\n' ;
            html += '      <div class="layui-form-item">\n' ;
            html += '       <label class="layui-form-label">角色列表</label>\n' ;
            html += '              <div class="layui-input-inline">\n' ;
            html += '                  <select name="roleId" lay-verify="required" lay-search="">' ;

            res.forEach(function (value) {
                var sele = value.status == 10?'selected':'';
                html += '<option value="'+value.id+'" '+sele +' >'+value.name+'</option>'
            })

            html += '                  </select>\n' ;
            html += '              </div>\n' ;
            html += '      </div>\n' ;
            html += '\n' ;
            html += '      <div class="layui-form-item">\n' ;
            html += '          <div class="layui-input-block">\n' ;
            html += '              <button class="layui-btn" lay-submit="" lay-filter="bindRole">立即提交</button>\n' ;
            html += '              <button type="reset" class="layui-btn layui-btn-primary">重置</button>\n' ;
            html += '          </div>\n' ;
            html += '      </div>\n' ;
            html += '  </form>';

            $("#adminBind").html(html)
            layui.use('form', function() {
                var form = layui.form;

                form.render();
                form.render('select');
            });
        }, true)

    </script>
  </body>

</html>